package com.edu.compile.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.ParserConfig;
import com.edu.compile.template.ftl.block.Http;

/**
 * @author yanzhao
 * @date 2021/10/18 23:18
 * @since 1.0.0
 */
public class JsonUtils {

    static {
        ParserConfig.getGlobalInstance().setSafeMode(true);
    }

    public static String toJSONString(Object object) {
        return JSON.toJSONString(object);

    }

    public static <T> T parseObject(String text, Class<T> clazz) {
        return JSON.parseObject(text, clazz);
    }

    public static void main(String[] args) {
        Http http = parseObject(null, Http.class);
        System.out.println(http);
    }
}
